

package feesmodule.converter;

import feesmodule.domain.Program;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class ProgramConverter
{
    private Program item;
    public ProgramConverter()
    {
    }
    public ProgramConverter(Program program)
    {
        this.item = program;
    }

    @XmlElement
    public String getProgramName()
    {
        return item.getProgramName();
    }

    @XmlElement(name="feedata")
    public FeeDataConverter getFeeData()
    {
        if(item.getFeeData() != null)
            return new FeeDataConverter(item.getFeeData());
        return null;
    }

    @XmlElement(name="qualification")
    public Collection<ProgramConverter> getQualification()
    {
        List<Program> qualification = item.getQualifictationPrograms();
        if(qualification != null)
        {
            List<ProgramConverter> result = new ArrayList<ProgramConverter>();
            for(Program qualificationProgram: qualification)
            {
                result.add(new ProgramConverter(qualificationProgram));
            }
            return result;

        }
        return null;
    }
}
